﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AchievingRateRept.aspx.cs"
    Inherits="FX.CC.Andon.WebSite.ReportManage.AchievingRateRept" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>达成率报表</title>
    <script src="../lib/boot.js" type="text/javascript"></script>
</head>
<body>
    <div class="mini-toolbar" style="padding: 2px; border-bottom: 0;">
        <table>
            <tr>
                <td align="right">
                    开始日期：
                </td>
                <td style="width: 150px;" align="left">
                    <input id="BizDateFrom" style="width: 150px;" class="mini-datepicker" format="yyyy-MM-dd" />
                </td>
                <td align="right">
                    结束日期：
                </td>
                <td style="width: 150px;" align="left">
                    <input id="BizDateEnd" style="width: 150px;" class="mini-datepicker" format="yyyy-MM-dd" />
                </td>
                <td align="right">
                    产品：
                </td>
                <td style="width: 150px;" align="left">
                    <div id="PrdID" name="PrdID" class="mini-combobox" style="width: 150px;" popupwidth="400"
                        textfield="PrdName" valuefield="PrdID">
                        <div property="columns">
                            <div header="产品编号" field="PrdCode" width="40%">
                            </div>
                            <div header="产品名称" field="PrdName" width="60%">
                            </div>
                        </div>
                    </div>
                </td>
                <td>
                    <a class="mini-button" iconcls="icon-search" onclick="search()">查 询</a>
                </td>
            </tr>
            <tr>
                <td align="right">
                    产线：
                </td>
                <td style="width: 150px;" align="left">
                    <div id="LineID" name="LineID" class="mini-combobox" style="width: 150px;" popupwidth="400"
                        onvaluechanged="onLineIDChanged" textfield="LineName" valuefield="LineID" url="../Service/BasicDataManageHandler.ashx?action=GetLineListByCombobox">
                        <div property="columns">
                            <div header="产线编号" field="LineCode" width="40%">
                            </div>
                            <div header="产线名称" field="LineName" width="60%">
                            </div>
                        </div>
                    </div>
                </td>
                <td align="right">
                    设备：
                </td>
                <td style="width: 150px;" align="left">
                    <div id="EqID" name="EqID" class="mini-combobox" style="width: 150px;" popupwidth="400"
                        textfield="EqName" valuefield="EqID">
                        <div property="columns">
                            <div header="设备编号" field="EqCode" width="40%">
                            </div>
                            <div header="设备名称" field="EqName" width="60%">
                            </div>
                        </div>
                    </div>
                </td>
                <td align="right">
                    班次：
                </td>
                <td style="width: 150px;" align="left">
                    <input id="ShiftID" class="mini-combobox" style="width: 150px;" textfield="ShiftName"
                        valuefield="ShiftID" shownullitem="true" allowinput="false" />
                </td>
                <td>
                    <a class="mini-button" iconcls="icon-reset" onclick="reset()">重 置</a>
                </td>
            </tr>
        </table>
    </div>
    <div class="mini-toolbar" style="padding: 2px; border-bottom: 0;">
        <table style="width: 100%;">
            <tr>
                <td style="width: 100%;">
                    <a class="mini-button" iconcls="icon-excel" onclick="ExportExcel();" plain="true">导出Excel</a>
                    <span class="separator"></span><a class="mini-button" onclick="close()" iconcls="icon-close"
                        plain="true">关闭</a>
                </td>
            </tr>
        </table>
    </div>
    <!--撑满页面-->
    <div class="mini-fit">
        <div id="datagrid1" class="mini-datagrid" style="width: 100%; height: 100%;" sizelist="[10,20,50,100]"
            pagesize="20">
            <div property="columns">
                <div type="indexcolumn">
                </div>
                <div field="BizDate" width="80" headeralign="center" allowsort="true" dateformat="yyyy-MM-dd">
                    日期
                </div>
                <div field="PrdCode" width="100" headeralign="center" allowsort="true">
                    产品编号
                </div>
                <div field="PrdName" width="130" headeralign="center" allowsort="true">
                    产品名称
                </div>
                <div field="EqCode" width="100" headeralign="center" allowsort="true">
                    设备编号
                </div>
                <div field="EqName" width="180" headeralign="center" allowsort="true">
                    设备名称
                </div>
                <div field="LineCode" width="100" headeralign="center" allowsort="true">
                    产线编号
                </div>
                <div field="LineName" width="130" headeralign="center" allowsort="true">
                    产线名称
                </div>
                <div field="ShiftName" width="70" headeralign="center" allowsort="true">
                    班次
                </div>
                <div field="PlanQty" width="80" headeralign="center" allowsort="true">
                    计划产量
                </div>
                <div field="ConfirmQty" width="80" headeralign="center" allowsort="true">
                    实际产量
                </div>
                <div field="PlanStartTime" width="120" headeralign="center" allowsort="true" dateformat="yyyy-MM-dd HH:mm">
                    计划开始时间
                </div>
                <div field="PlanEndTime" width="120" headeralign="center" allowsort="true" dateformat="yyyy-MM-dd HH:mm">
                    计划结束时间
                </div>
                <div field="ElapsedTime" width="100" headeralign="center" allowsort="true">
                    生产时长(分钟)
                </div>
                <div field="Rate" width="90" headeralign="center" allowsort="true">
                    达成率
                </div>
            </div>
        </div>
    </div>
    <iframe id="exportIFrame" style="display: none;"></iframe>
    <script type="text/javascript">
        mini.parse();
        var now = new Date();
        var nowYear = now.getFullYear();
        var nowMonth = now.getMonth();
        var bizDateFrom = mini.get("BizDateFrom");
        bizDateFrom.setValue(new Date(nowYear, nowMonth, 1));
        var bizDateEnd = mini.get("BizDateEnd");
        bizDateEnd.setValue(new Date());
        var grid = mini.get("datagrid1");
        var EqID = mini.get("EqID");
        var PrdID = mini.get("PrdID");
        var ShiftID = mini.get("ShiftID");
        ShiftID.setUrl("../Service/BasicDataManageHandler.ashx?action=GetShiftListByCombobox");
        PrdID.setUrl("../service/BasicDataManageHandler.ashx?action=GetProductListByCombobox");
        grid.setUrl("../service/ReportManageHandler.ashx?action=GetAchievingRateReptList");
        grid.load({ BizDateFrom: mini.get("BizDateFrom").getFormValue(), BizDateEnd: mini.get("BizDateEnd").getFormValue() });
        function onLineIDChanged(e) {
            EqID.setUrl("../service/BasicDataManageHandler.ashx?action=GetEquipmentListByCombobox&LineID=" + e.value);
        }

        function search() {
            var BizDateFrom = mini.get("BizDateFrom").getFormValue();
            var BizDateEnd = mini.get("BizDateEnd").getFormValue();
            var LineID = mini.get("LineID").getValue();
            var EqID = mini.get("EqID").getValue();
            var ShiftID = mini.get("ShiftID").getValue();
            var PrdID = mini.get("PrdID").getValue();
            grid.load({ BizDateFrom: BizDateFrom, BizDateEnd: BizDateEnd, LineID: LineID, EqID: EqID, ShiftID: ShiftID, PrdID: PrdID });
        }

        //回车键事件
        function onKeyEnter() {
            search();
        }

        function reset() {
            var now = new Date();
            var nowYear = now.getFullYear();
            var nowMonth = now.getMonth();
            var bizDateFrom = mini.get("BizDateFrom");
            bizDateFrom.setValue(new Date(nowYear, nowMonth, 1));
            var bizDateEnd = mini.get("BizDateEnd");
            bizDateEnd.setValue(new Date());
            mini.get("LineID").setValue("");
            mini.get("EqID").setData("[]");
            mini.get("EqID").setValue("");
            mini.get("ShiftID").setValue("");
            mini.get("PrdID").setValue("");
        }
        function ExportExcel() {
            var BizDateFrom = mini.get("BizDateFrom").getFormValue();
            var BizDateEnd = mini.get("BizDateEnd").getFormValue();
            var LineID = mini.get("LineID").getValue();
            var EqID = mini.get("EqID").getValue();
            var ShiftID = mini.get("ShiftID").getValue();
            var PrdID = mini.get("PrdID").getValue();
            var url = "../Service/ReportManageHandler.ashx?action=ExportAchievingRateRept&BizDateFrom=" + BizDateFrom + "&BizDateEnd=" + BizDateEnd + "&LineID=" + LineID + "&EqID=" + EqID + "&ShiftID=" + ShiftID + "&PrdID=" + PrdID;
            var exportIFrame = document.getElementById("exportIFrame");
            exportIFrame.src = url;
        }

        function CloseWindow(action) {
            if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
            else window.close();
        }
        function close() {
            CloseWindow("close");
        }
    </script>
</body>
</html>
